package com.lzy.conf;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * description: InterceptorConfig ()<br>
 * date: 2020-12-1 20:37 <br>
 * author: lcc <br>
 * version: 1.0 <br>
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册TestInterceptor拦截器
        InterceptorRegistration registration = registry.addInterceptor(new LogCostInterceptor());
        registration.addPathPatterns("/**");                      //所有路径都被拦截
    }
}
